<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3">
<head th:include="public/page_css::page_css ('增加包装信息')"/>

<body>
<div class="layui-fluid larry-wrapper">
    <div class="layui-row layui-col-space30">
        <div class="layui-col-xs24">
            <section class="panel panel-padding">
                <form id="form1" class="layui-form layui-form-pane" action="">
                    <div class="step-content" id="simplewizardinwidget-steps">
                        <div class="step-pane active" id="simplewizardinwidgetstep1">
                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label" data-title>包装名称</label>
                                    <div class="layui-input-inline">
                                        <input type="text" name="bzmc" placeholder="包装名称" autocomplete="off" lay-verify="required" class="layui-input "/>
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">货品名称</label>
                                    <div class="layui-input-inline">
                                        <select lay-ignore="lay-ignore" class="js-data-example-ajax" name="fphpid" lay-verify="required" style="width: 193px"></select>
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">包装描述</label>
                                    <div class="layui-input-inline">
                                        <input type="text" name="ms" placeholder="包装描述" autocomplete="off" class="layui-input "/>
                                    </div>
                                </div>
                            </div>
                            <div class="layui-form-item layui-form-text">
                                <label class="layui-form-label">主单位</label>
                            </div>
                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label">数量</label>
                                    <div class="layui-input-inline">
                                        <input type="text" name="zdwsl" placeholder="数量" lay-verify="required|number" autocomplete="off" class="layui-input " />
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">包装描述</label>
                                    <div class="layui-input-inline">
                                        <input type="text" name="zdwms" placeholder="包装描述" autocomplete="off" class="layui-input "/>
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">长度</label>
                                    <div class="layui-input-inline">
                                        <input type="text" name="zdwsl" placeholder="长度" lay-verify="required|number" autocomplete="off" class="layui-input "/>
                                    </div>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label">宽度</label>
                                    <div class="layui-input-inline">
                                        <input type="text" name="zdwsl" placeholder="宽度" lay-verify="required|number" autocomplete="off" class="layui-input "/>
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">高度</label>
                                    <div class="layui-input-inline">
                                        <input type="text" name="zdwsl" placeholder="高度" lay-verify="required|number" autocomplete="off" class="layui-input "/>
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">体积</label>
                                    <div class="layui-input-inline">
                                        <input type="text" name="zdwsl" placeholder="体积" lay-verify="required|number" autocomplete="off" class="layui-input "/>
                                    </div>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <div class="layui-inline">
                                    <label class="layui-form-label">重量</label>
                                    <div class="layui-input-inline">
                                        <input type="text" name="zdwsl" placeholder="重量" lay-verify="required|number" autocomplete="off" class="layui-input "/>
                                    </div>
                                </div>
                            </div>
                            <!--箱 数量-->
                            <div class="layui-form-item layui-form-text">
                                <label class="layui-form-label">箱</label>
                            </div>
                            <div class="layui-inline">
                                <label class="layui-form-label">主单位</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="zdwsl" placeholder="箱" lay-verify="required|number" autocomplete="off" class="layui-input "/>
                                </div>
                            </div>
                            <!--托盘 数量-->
                            <div class="layui-form-item layui-form-text">
                                <label class="layui-form-label">托盘</label>
                            </div>
                            <div class="layui-inline">
                                <label class="layui-form-label">主单位</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="zdwsl" placeholder="托盘" lay-verify="number" autocomplete="off" class="layui-input "/>
                                </div>
                            </div>
                            <div class="layui-inline">
                                <label class="layui-form-label">TI</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="zdwsl" placeholder="TI" lay-verify="required|number" autocomplete="off" class="layui-input "/>
                                </div>
                            </div>
                            <div class="layui-inline">
                                <label class="layui-form-label">HI</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="zdwsl" placeholder="HI" lay-verify="required|number" autocomplete="off" class="layui-input "/>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <div class="layui-input-block">
                                    <button class="layui-btn" jq-filter="submit" lay-submit="" lay-filter="addKuQu">
                                        立即提交
                                    </button>
                                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                                </div>
                            </div>
                        </div>
                    </div>
                </form>
            </section>
        </div>
    </div>
</div>
</body>
<div th:include="public/public_js::public_js"></div>

<script th:inline="javascript">
    $(function () {

        $('.js-data-example-ajax').select2({
            ajax: {
                url: '/zxsswms/wmspacking/getSelectGoods',
                dataType: 'json',
                type: 'POST',
                contentType: "application/json",
                data: function (params) {
                    var query = {
                        mc: params.term
                    };
                    return JSON.stringify(query);
                },
                processResults: function (data) {
                    var arr = new Array();
                    if (data) {
                        for (var i = 0; i < data.length; i++) {
                            arr.push({id: data[i].id, text: data[i].mc});
                        }
                    }
                    console.log(arr);
                    // Tranforms the top-level key of the response object from 'items' to 'results'
                    return {
                        results: arr
                    };
                },
                cache: true
            },
            language: "zh-CN",
            placeholder: '请输入查询字段',
            allowClear: true
        });
        console.log("我来了！！ ");
        $(".moreBtn").on("click", function () {
            $(".moreSearch").toggle();
        })
    });
</script>
<script>
    layui.use(['myform', 'zzpUtils', 'form', 'jquery'], function () {
        var form = layui.form,
            zzpUtils = layui.zzpUtils,
            $ = layui.jquery;

        form.on("submit(addKuQu)", function (data) {
            // console.log(zzpUtils.getFormJson($("#form1")));
            zzpUtils.confirm("是否确定添加", function (index) {
                zzpUtils.action({
                    url: "/wmspacking/add",
                    data: JSON.stringify(data.field),
                    success: function (data) {
                        setTimeout(function () {
                            var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                            parent.layer.close(index); //再执行关闭
                            top.layer.msg(data.title+data.message);
                        }, 500);
                    }, error: function (xhr, textStatus) {
                        console.log(textStatus);
                        console.log(xhr);
                    }
                })
            })
            return false;
        });
    });
</script>
</html>